//package com.ruoyi.electronicFence.service.impl;
//
//import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
//import com.ruoyi.common.config.DbInterfaceConfig;
//import com.ruoyi.common.core.page.TableDataInfo;
//import com.ruoyi.common.utils.DateUtils;
//import com.ruoyi.electronicFence.domain.vo.ReqVo;
//import com.ruoyi.electronicFence.utils.HttpUtil;
//import com.ruoyi.electronicFence.domain.A2DynamicsInfo;
//import com.ruoyi.electronicFence.domain.A2StaticInfo;
//import com.ruoyi.electronicFence.domain.dto.A2StaticInfoCondition;
//import com.ruoyi.electronicFence.mapper.A2StaticInfoMapper;
//import com.ruoyi.electronicFence.service.IA2DynamicsInfoService;
//import com.ruoyi.electronicFence.service.IA2StaticInfoService;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Service;
//
//import java.util.List;
//
///**
// * AIS/ADS-B静态信息Service业务层处理
// *
// * @author ruoyi
// * @date 2025-02-14
// */
//@Service
//public class A2StaticInfoServiceImpl extends ServiceImpl<A2StaticInfoMapper, A2StaticInfo> implements IA2StaticInfoService
//{
//    @Autowired
//    private A2StaticInfoMapper a2StaticInfoMapper;
//
//    @Autowired
//    private IA2DynamicsInfoService a2DynamicsInfoService;
//
//    @Autowired
//    private DbInterfaceConfig dbInterfaceConfig;
//
//    /**
//     * 查询AIS/ADS-B静态信息
//     *
//     * @param id AIS/ADS-B静态信息主键
//     * @return AIS/ADS-B静态信息
//     */
//    @Override
//    public A2StaticInfo selectA2StaticInfoById(Long id)
//    {
//        return a2StaticInfoMapper.selectA2StaticInfoById(id);
//    }
//
//    /**
//     * 查询AIS/ADS-B静态信息列表
//     *
//     * @param a2StaticInfo AIS/ADS-B静态信息
//     * @return AIS/ADS-B静态信息
//     */
//    @Override
//    public List<A2StaticInfo> selectA2StaticInfoList(A2StaticInfo a2StaticInfo)
//    {
//        return a2StaticInfoMapper.selectA2StaticInfoList(a2StaticInfo);
//    }
//
//    /**
//     * 新增AIS/ADS-B静态信息
//     *
//     * @param a2StaticInfo AIS/ADS-B静态信息
//     * @return 结果
//     */
//    @Override
//    public int insertA2StaticInfo(A2StaticInfo a2StaticInfo)
//    {
//        a2StaticInfo.setCjsj(DateUtils.getNowDate());
//        return a2StaticInfoMapper.insertA2StaticInfo(a2StaticInfo);
//    }
//
//    /**
//     * 修改AIS/ADS-B静态信息
//     *
//     * @param a2StaticInfo AIS/ADS-B静态信息
//     * @return 结果
//     */
//    @Override
//    public int updateA2StaticInfo(A2StaticInfo a2StaticInfo)
//    {
//        a2StaticInfo.setUpdateTime(DateUtils.getNowDate());
//        return a2StaticInfoMapper.updateA2StaticInfo(a2StaticInfo);
//    }
//
//    /**
//     * 批量删除AIS/ADS-B静态信息
//     *
//     * @param ids 需要删除的AIS/ADS-B静态信息主键
//     * @return 结果
//     */
//    @Override
//    public int deleteA2StaticInfoByIds(Long[] ids)
//    {
//        return a2StaticInfoMapper.deleteA2StaticInfoByIds(ids);
//    }
//
//    /**
//     * 删除AIS/ADS-B静态信息信息
//     *
//     * @param id AIS/ADS-B静态信息主键
//     * @return 结果
//     */
//    @Override
//    public int deleteA2StaticInfoById(Long id)
//    {
//        return a2StaticInfoMapper.deleteA2StaticInfoById(id);
//    }
//
//    @Override
//    public TableDataInfo page(A2StaticInfoCondition condition) {
////        QueryWrapper<A2StaticInfo> wrapper = new QueryWrapper<>();
////        if(StringUtils.isNotBlank(condition.getWords())){
////            wrapper.like("name", condition.getWords());
////        }
////        if(condition.getTargetClass()!=null){
////            wrapper.eq("lx", condition.getTargetClass());
////        }
////        wrapper.orderByDesc("id");
////        IPage<A2StaticInfo> page = page(new Page<>(condition.getPageNum(), condition.getPageSize()), wrapper);
////        for(A2StaticInfo bean:page.getRecords()){
////            //根据【mmsiIcao】查询最后一个动态点位
////            A2DynamicsInfo last = a2DynamicsInfoService.getLast(bean.getMmsiicao());
////            if(last!=null){
////                bean.setJd(last.getJd());
////                bean.setWd(last.getWd());
////            }
////        }
//
//        StringBuilder sb = new StringBuilder("");
//        sb.append("SELECT id,sail_danger,ship_lenght,integrity_lx,ship_level,launcher_lx,lx,broadcast_lx,aircraft_lx,indicator_lx,terminal_speed,flag_data,design_assurance,position_precision,vertical_precision,sail_destination,ship_width,load_tonnage,ship_lx,name,position_mass,integrity_level,qyzt,aircraft_height,full_load,engine_lx,imo,bz,ship_country,mmsi_icao,update_by,wail,antenna_position,shipman_num,aircraft_span,aircraft_length,update_time,ads_version,create_by,altineter_settings,cjsj,pressure_lx,stop_radius,rudder_angle " +
//                "FROM J_KY_R_FJJCJTB ORDER BY id DESC ");
//        List<A2StaticInfo> staticInfos = (List<A2StaticInfo>) HttpUtil.getListBean(dbInterfaceConfig, new ReqVo(sb.toString()), A2StaticInfo.class);
//        staticInfos.forEach(sta -> {
//            StringBuilder sb1 = new StringBuilder("SELECT id,lat,lon" +
//                    " FROM J_KY_S_AISADSBDWXX WHERE mmsi_icao = '").append(sta.getMmsiicao()) .append("' ORDER BY id DESC");
//            List<A2DynamicsInfo> listBean = (List<A2DynamicsInfo>) HttpUtil.getListBean(dbInterfaceConfig, new ReqVo(sb1.toString()), A2DynamicsInfo.class);
//            if (listBean != null){
//                sta.setJd(listBean.get(0).getJd());
//                sta.setWd(listBean.get(0).getWd());
//            }
//        });
//
//        TableDataInfo tableDataInfo = new TableDataInfo();
//        tableDataInfo.setRows(staticInfos);
////        tableDataInfo.setTotal(page.getTotal());
//        return tableDataInfo;
//    }
//}
